import request from '@/utils/request'
import requestFile from '@/utils/request-file'
import requestUpload from '@/utils/request-upload'
import {
  formatDateByFmt
} from '@/utils/util.js'

const prefixUrl = 'web/media_point'

// 录入点位
export function pointAdd(data) {
  return request({
    url: prefixUrl + '/save',
    method: 'post',
    data: data,
    content_type: 'json'
  })
}

export function edit(data) {
  return request({
    url: prefixUrl + `/edit`,
    method: 'post',
    data: data,
    content_type: 'json'
  })
}

// 获取点位列表
export function list(params) {
  return request({
    url: prefixUrl + '/list',
    method: 'get',
    params
  })
}

// 获取特殊点位列表
export function special_list(params) {
  return request({
    url: prefixUrl + '/special_list',
    method: 'get',
    params
  })
}

// 单点位详情
export function oneDetail(id) {
  return request({
    url: prefixUrl + `/detail/${id}`,
    method: 'get'
  })
}

// 校验code唯一
export function checkCode(params) {
  return request({
    url: prefixUrl + '/checkCode',
    method: 'get',
    params
  })
}

// 校验code唯一
export function checkABCode(params) {
  return request({
    url: prefixUrl + '/checkABCode',
    method: 'get',
    params
  })
}

// 注销
export function del(params) {
  return request({
    url: prefixUrl + '/delete',
    method: 'delete',
    params
  })
}

export function uploadPoint(params) {
  return request({
    url: prefixUrl + '/import_common',
    method: 'post',
    // headers: {
    //   'Content-Type': 'multipart/form-data;boundary=---ba77f35b192c8918628309c77e6add06'
    //   },
    data: params,
    content_type: 'json'
  })
}

export function uploadABPoint(params) {
  return request({
    url: prefixUrl + '/import_ab',
    method: 'post',
    data: params,
    content_type: 'json'
  })
}

// 注销
export function abnormal(params) {
  return request({
    url: prefixUrl + '/abnormal',
    method: 'post',
    params
  })
}
